<pre>
def is_equal_chars(str1, str2):
    cnt = {}
    if len(str1) != len(str2):  # 两字符串长度必须一致
        return False
    for c in str1:
        cnt[c] = cnt.get(c, 0) + 1
    for c in str2:
        if c not in cnt:
            return False
        # 两字符串长度必须一致
        cnt[c] -= 1
        if cnt[c] < 0:   
            return False
    return True


if __name__ == "__main__":
    str1 = input()
    str2 = input()
    result = is_equal_chars(str1, str2)
    print(result)
</pre>